'''
	This file is part of pyNN.
 
 	Copyright 2009 Michael Morckos <mikey.morckos@gmail.com>
 
 	pyNN is free software: you can redistribute it and/or modify
 	it under the terms of the GNU General Public License as published by
 	the Free Software Foundation, either version 3 of the License, or
 	(at your option) any later version.
 
 	pyNN is distributed in the hope that it will be useful,
 	but WITHOUT ANY WARRANTY; without even the implied warranty of
 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 	GNU General Public License for more details.
 
 	You should have received a copy of the GNU General Public License
 	along with pyNN.  If not, see <http://www.gnu.org/licenses/>.
'''

import random
import neuron
import data

class Synapse:
		def __init__(self, src_neuron):
   		     	self.src_neuron = src_neuron
    	   		self.weight = random.uniform(0, 1)
    	   		self.dweight = 0.0
    	
		def update_weight(self, doutput) :
				dw = (data.alpha * self.dweight) + (data.eita * doutput * self.src_neuron.output_signal)
				self.dweight = dw
				self.weight += self.dweight		
				
